<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<script type="text/javascript">
function checkAll(id) {
	var item = document.getElementById(id);
	var it = document.getElementsByName("arrayId");
	if (item.checked) {
		for(var i = 0; i < it.length; i++) {
			if (!it[i].checked) {
				it[i].checked = true;
			}
		}
	} else {
		for(var i = 0; i < it.length; i++) {
			if (it[i].checked) {
				it[i].checked = false;
			}
		}
	}
}
</script>

<s:actionmessage/>
<s:actionerror/>
<s:if test="tExaminationEntityList.size() > 0">
	<div class="content">
	<table class="userTable" cellpadding="5px">
		<tr class="even">
			<th><input type="checkbox" id="allId" onclick="checkAll(this.id)"/></th>
			<th>Mã đề</th>
			<th>Tiêu đề</th>
			<th>Số lương câu hỏi</th>
			<th>Thời gian thi</th>
			<th>Trạng thái thi</th>
			<th>Chủ đề</th>
			<th>Ngày tạo</th>
			<th>Ngày cập nhật</th>
			<th>Hành động</th>
		</tr>
		<s:iterator value="tExaminationEntityList" status="userStatus">
			<tr
				class="<s:if test="#userStatus.odd == true ">odd</s:if><s:else>even</s:else>">
				<td>
					<input type="checkbox" name="arrayId" value='<s:property value="examId"/>' onclick="checkBox(this.name)">
				</td>
				<td><s:property value="examCd" /></td>
				<td><s:property value="examTitle" /></td>
				<td><s:property value="questNum" /></td>
				<td><s:property value="examTime" /></td>
				<td>
					<s:if test="status==1">
						Đã thi
					</s:if>
					<s:else>
						Chưa thi
					</s:else>
				</td>
				<td><s:property value="subQuestionEntity.subject" /></td>
				<td><s:date name="createDate" format="dd/MM/yyyy HH:mm:ss" /></td>
				<td><s:date name="updateDate" format="dd/MM/yyyy HH:mm:ss" /></td>
				<td colspan="3">
					<s:url id="viewURL" action="viewExamination">
						<s:param name="examId" value="%{examId}"></s:param>
					</s:url> <s:a href="%{viewURL}">View</s:a> | 
					<s:url id="editURL" action="editExamination">
						<s:param name="examId" value="%{examId}"></s:param>
					</s:url> <s:a href="%{editURL}">Edit</s:a> |
					<s:url id="deleteURL" action="deleteExamination">
						<s:param name="examId" value="%{examId}"></s:param>
					</s:url> <s:a href="%{deleteURL}">Delete</s:a> | 
					<s:url id="createQuestionExaminationURL" action="createQuestionExamination">
						<s:param name="examId" value="%{examId}"></s:param>
						<s:param name="subQuestId" value="%{subQuestionEntity.subQuestId}"></s:param>
					</s:url> <s:a href="%{createQuestionExaminationURL}">Create Question Examination</s:a>
				</td>
			</tr>
		</s:iterator>
	</table>
	</div>
</s:if>
<s:a href="addExamination.action">Add Examination</s:a>
<s:a href="/">Home</s:a>